#include "setdialog.h"
#include "ui_setdialog.h"
#include <QFontDialog>

double SetTimeUIDialog::getOpacityShow()
{
    return ui->horizontalScrollBarOpaciityShow->value()*1.0/100;
}

double SetTimeUIDialog::getOpacityHide()
{
    return ui->horizontalScrollBarOpaciityHide->value()*1.0/100;
}

bool SetTimeUIDialog::getIsShow12H()
{
    if(ui->radioBtn12H->isChecked()){
        return true;
    }else{
        return false;
    }
}

bool SetTimeUIDialog::getIsShowS()
{
    if(ui->radioBtnShowMetret->isChecked()){
        return true;
    }else{
        return false;
    }
}

bool SetTimeUIDialog::getIsShowDate()
{
    if(ui->radioBtnShowDate->isChecked()){
        return true;
    }else{
        return false;
    }
}

bool SetTimeUIDialog::getIsShowIcon()
{
    if(ui->radioBtnShowIcon->isChecked()){
        return true;
    }else{
        return false;
    }
}

QFont SetTimeUIDialog::getFont()
{
    return m_font;
}

QColor SetTimeUIDialog::getColor()
{
    return m_color;
}

void SetTimeUIDialog::setOpacity(double opacityShow, double opacityHide)
{
    ui->horizontalScrollBarOpaciityShow->setValue(int(opacityShow*100));
    ui->horizontalScrollBarOpaciityHide->setValue(int(opacityHide*100));
}

void SetTimeUIDialog::setHour(bool isShow12H)
{
    if(isShow12H){
        ui->radioBtn12H->setChecked(true);
    }else{
        ui->radioBtn24H->setChecked(true);
    }
}

void SetTimeUIDialog::setS(bool isShowS)
{
    if(isShowS){
        ui->radioBtnShowMetret->setChecked(true);
    }else{
        ui->radioBtnHideMetrer->setChecked(true);
    }
}

void SetTimeUIDialog::setDate(bool isShowDate)
{
    if(isShowDate){
        ui->radioBtnShowDate->setChecked(true);
    }else{
        ui->radioBtnHideDate->setChecked(true);
    }
}

void SetTimeUIDialog::setIcon(bool isShowIcon)
{
    if(isShowIcon){
        ui->radioBtnShowIcon->setChecked(true);
    }else{
        ui->radioBtnHideIcon->setChecked(true);
    }
}

void SetTimeUIDialog::showFont(QFont font)
{
    ui->labelFont->setText(font.toString());
    m_font=font;
}

void SetTimeUIDialog::showColor(QColor color)
{

}

SetTimeUIDialog::SetTimeUIDialog(QWidget *parent)
    : QDialog(parent)
    , ui(new Ui::SetTimeUIDialog)
{
    ui->setupUi(this);
}

SetTimeUIDialog::~SetTimeUIDialog()
{
    delete ui;
}


void SetTimeUIDialog::on_btnSelectFont_clicked()
{
    // showMinimized();
    QFont font=m_font;
    bool ok=false;
    font=QFontDialog::getFont(&ok,font);
    if(ok){
        m_font=font;
        ui->labelFont->setText(font.toString());
    }
    // showNormal();
}

